﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BL.objects
{
    public class Node
    {
        public int Id { get; set; }
        public double Cost { get; set; }
        public bool Visited { get; set; }
        public NodesEdge BestEdge { get; set; }
        public bool UnInitialized { get; set; }
        public LongLat LongLat { get; set; }

        public Node(Vertex vertex)
        {
            Id = vertex.Id;
            UnInitialized = true;
            BestEdge = null;
            LongLat = vertex.LongLat;
        }

        public void Clear()
        {
            Visited = false;
            BestEdge = null;
            UnInitialized = true;
        }

        public void Update(double cost, NodesEdge edge)
        {
            Cost = cost;
            BestEdge = edge;
            UnInitialized = false;
        }

        public static bool operator ==(Node a, Vertex b)
        {
            return a.Id == b.Id;
        }

        public static bool operator !=(Node a, Vertex b)
        {
            return !(a == b);
        }

        public static bool operator ==(Node a, Node b)
        {
            return a.Id == b.Id;
        }

        public static bool operator !=(Node a, Node b)
        {
            return !(a == b);
        }
    }
}
